package com.example.sourcecodelearning.controller;

import com.example.framework.common.pojo.R;
import com.example.sourcecodelearning.modules.product.impl.ProductService;
import com.manticoresearch.client.model.SuccessResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "商品接口，使用ManticoreSearch")
@RestController
@RequestMapping("/product")
public class ProductController {

    @Resource
    private ProductService productService;

    @GetMapping("/save")
    public R<SuccessResponse> saveProduct() {
        SuccessResponse response = productService.saveProduct();
        return R.success(response);
    }

    @GetMapping("/list")
    public R<List<Object>> getProductList() {
        List<Object> select = productService.getProductList();
        return R.success(select);
    }

}
